home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / prolog / modprolg / mod-prol.lha / Prolog / Examples / slide2.mod < prev    next >
Text File  |  1992-06-09  |  515b  |  20 lines

  1.     signature searchsig =
  2.         sig
  3.             pred solve/2.
  4.         end.
  5.  
  6.     functor dfs(p/problemsig)/searchsig =
  7.         struct
  8.             structure x = p.
  9.             solve(Node,Solution) :-
  10.                 df([],Node,Solution).
  11.             df(Path,Node,[Node|Path]) :-
  12.                 x:goal(Node).
  13.             df(Path,Node,Sol) :-
  14.                 x:s(Node,Node1),
  15.                 not member(Node1,Path),
  16.                 df([Node|Path],Node1,Sol).
  17.         end.
  18.  
  19.     structure eightdfs = dfs(eightqueens).
  20.